#ifndef GMAILE_GMAILFRAME_H
#define GMAILE_GMAILFRAME_H

#include <QPushButton>
#include <QFrame>
#include <QLabel>
#include <QList>

namespace GMail
{
	struct GMailTag;
	class TagFrame;
	class GMailContext;
	class GMailFrame : public QFrame
	{
		Q_OBJECT
		Q_PROPERTY(int tagStartPosY READ tagStartPosY WRITE setTagStartPosY)
		Q_PROPERTY(int tagSpacingY READ tagSpacingY WRITE setTagSpacingY)

		public:
			GMailFrame(QList<GMailTag>& tags,GMailContext* c);
			virtual ~GMailFrame();

			void tagsChanged();
			// The index starts with -1
			void tagUpdated(int index,int newCount);

			void errorOccured();

			int tagStartPosY()const{return i_tagStartY;}
			void setTagStartPosY(int y){i_tagStartY = y;}
			int tagSpacingY()const{return i_tagSpacingY;}
			void setTagSpacingY(int y){i_tagSpacingY = y;}
		protected:
			void resizeEvent(QResizeEvent*);
		private:
			int i_tagStartY;
			int i_tagSpacingY;

			QFrame			m_toolFrame;
			QLabel			m_updateTimeLabel;
			QPushButton		m_configBtn;
			GMailContext*	m_context;

			QList<GMailTag>& m_tags;
			QList<TagFrame*> m_tagFrames;
			friend class GMailContext;
	};
}

#endif /* GMAILE_GMAILFRAME_H */
